﻿using Iworld.Author.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Iworld.Author.Service.Client.Export
{
    /// <summary>
    /// 用户信息
    /// </summary>
    [DataContract]
    public class AuthorExport
    {
        public AuthorExport(Iworld.Author.Model.Author author)
        {
            this.Id = author.Id;
            this.Account = author.Account;
            this.Username = author.Username;
            this.CreatedTime = author.CreatedTime;
            this.LastLoginTime = author.LastLoginTime;
            this.LastLoginIp = author.LastLoginIp;
            this.LastLoginAddress = author.LastLoginAddress;
            this.Golds = author.Golds;
            this.QQ = author.QQ;
            this.Phone = author.Phone;
            this.IdentityCard = author.IdentityCard;
            this.Status = author.Status;
            if (author.Banks!=null)
            {
                this.Banks = new List<AuthorBankExport>();
                foreach(var k in  author.Banks)
                {
                    this.Banks.Add(new AuthorBankExport(k));
                }
            }
            this.FrozenGolds = author.FrozenGolds;
        }

        /// <summary>
        /// 存储指针
        /// </summary>
        [DataMember]
        public int Id { get; set; }

        /// <summary>
        /// 账号名称
        /// </summary>
        [DataMember]
        public string Account { set; get; }

        /// <summary>
        /// 用户名
        /// </summary>
        [DataMember]
        public string Username { get; set; }

        /// <summary>
        /// 注册时间
        /// </summary>
        [DataMember]
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 上次登录时间
        /// </summary>
         [DataMember]
        public DateTime LastLoginTime { get; set; }

        /// <summary>
        /// 上次登录的网络地址
        /// </summary>
         [DataMember]
        public string LastLoginIp { get; set; }

        /// <summary>
        /// 上次登录的实际地址
        /// </summary>
        [DataMember]
        public string LastLoginAddress { get; set; }

        /// <summary>
        /// 金币数量
        /// </summary>
        [DataMember]
        public double Golds { set; get; }

        /// <summary>
        /// 冻结的金币数量
        /// </summary>
        [DataMember]
        public double FrozenGolds { set; get; }

        /// <summary>
        /// QQ号码
        /// </summary>
        [DataMember]
        public string QQ { set; get; }

        /// <summary>
        /// 电话号码
        /// </summary>
        [DataMember]
        public string Phone { set; get; }

        /// <summary>
        /// 身份证号码
        /// </summary>
        [DataMember]
        public string IdentityCard { set; get; }

        /// <summary>
        /// 用户状态
        /// </summary>
        [DataMember]
        public AuthorStatus Status { set; get; }

        /// <summary>
        /// 用户银行信息
        /// </summary>
        public List<AuthorBankExport> Banks { set; get; }
    }
}
